package com.hswealth;
/**
 *    @author    daixf41752
 *    @Date 2021-09-08 17:22:20    
 *
 */

import java.awt.Image;

import javax.swing.ImageIcon;

public class HeroPlane extends Thread{
	//飞机在画板上的位置
	int x = 135,y = 525;
	int width = 60, height = 60;
	//飞机移动速度
	int speed = 5;
	
	Image img = new ImageIcon("img/heroplane.png").getImage();
	
	//定义方向键的标志
	boolean up, down, left, right;

	public HeroPlane() {
		super();
	}



	public HeroPlane(int x, int y, int width, int height) {
		super();
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}



	@Override
	public void run() {
		while(true) {
			if (up) {
				y -= speed;
			}
			if (down) {
				y += speed;
			}
			if (left) {
				x -= speed;
			}
			if (right) {
				x += speed;
			}
			
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	

}
